<style>
    hr{
        margin-top: 3px!important;
        margin-bottom: 3px!important;
    }
</style>
<script>
    $(function() {
        $("#isAlone").change(function(){
            $("#content").removeClass("hidden");

        });
        $("#notAlone").change(function(){
            $("#content").addClass("hidden");

        });
    });
    function del(obj) {
        $(obj).bjuiajax('doAjax', {url:'${ctxPath}/system/cms/category/delete?ids=${pojo.categoryId!}',confirmMsg:'子节点也会被删除，确定要删除该吗？'});
    }
</script>
<div class="bjui-pageHeader">
    <div class="bjui-searchBar">

        <a class="btn" data-icon="pencil">${has(pojo)?"编辑栏目":"新增栏目"}</a>&nbsp;
    </div>
</div>
<div class="bjui-pageContent">
    <form method="post" action="${ctxPath}/system/cms/category/save" id="j_model_form" data-toggle="validate" data-autorefresh="true" data-alertmsg="false">
        <input TYPE="hidden" name="categoryId" value="${pojo.categoryId!}">
        <div class="form-group">
            <label for="j_username" class="control-label x85">栏目名称：</label>
            <input type="text" name="categoryName" id="j_username" size="30"  value="${pojo.categoryName!,xss}" placeholder="栏目名称" size="24" data-rule="required;" >
        </div>
        <hr>
        <div class="form-group">
            <label for="alias" class="control-label x85">栏目别名：</label>
            @if(isEmpty(pojo.alias)){
            <input type="text" name="alias" id="alias" size="30"  value="${pojo.alias!,xss}" placeholder="栏目别名（请使用英文别名！）" size="24" data-rule="required;remote(${ctxPath}/system/cms/category/checkCategory)" >
            @}else{
            <input type="text" name="alias" id="alias" size="30"  value="${pojo.alias!,xss}" placeholder="栏目别名（请使用英文别名！）" size="24" readonly >
            @}
        </div>
        <hr>
        <div class="form-group">
            <label for="parentId" class="control-label x85">父栏目：</label>
            <select id="parentId" data-toggle="selectpicker"  name="parentId">
                ${SelectCategoryOut(pojo.parentId!0,pojo.categoryId!0,session.SysUser.siteId!0)}
            </select>
        </div>
        <hr>
        <div class="form-group">
            <label for="categoryId" class="control-label x85">翻译到：</label>
            <select id="categoryId"  data-toggle="selectpicker"  class="input-nm"  readonly="readonly"   name="translatedCategoryId">
                ${SelectTranslateCategoryOut(pojo.parentId!0,pojo.translatedCategoryId!0,2)}
            </select>
            ( 此栏目的文章翻译后发布的英文站对赢的栏目！)
        </div>
        <hr>
        <!--判断是否为文件上传字段-->
        <script type="text/javascript">
            function categoryIcon_upload_success(file, data) {
                var json = $.parseJSON(data)
                $(this).bjuiajax('ajaxDone', json)
                if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
                    $('#categoryIcon').val(json.filename).trigger('validate');
                    $('#categoryIcon_file').val(json.filename);
                }
            }
        </script>
        <label for="categoryIcon" class="control-label x85">栏目图标：</label>
        <div style="display: inline-block; vertical-align: middle;">
            <div id="categoryIcon" data-toggle="upload" data-uploader="${ctxPath}/upload"
                 data-file-size-limit="1024000000"
                 data-file-type-exts="*.jpg;*.png;*.gif;*.jpeg"
                 data-multi="false"
                 data-on-upload-success="categoryIcon_upload_success"
                 data-icon="cloud-upload"></div>
            <span>
                   <input type="text"   style="margin: 5px 0 0 0"    size="30" name="categoryIcon" placeholder="分类图标" value="${pojo.categoryIcon!}" id="categoryIcon_file"> ( 可使用网络地址. )
                </span>
        </div>
        <hr>
        <div class="form-group">
            <label for="url" class="control-label x85">外部链接：</label>
            <input type="text"  id="url" name="url" size="30"
                   value="${pojo.url!}"  placeholder="外部链接"> ( 填写外部链接后以下设置将失效！)
        </div>
        <hr>
        <div class="form-group">
            <label for="permissionKey" class="control-label x85">权限标识：</label>
            <input type="text"  id="permissionKey" name="permissionKey" size="30"
                   value="${pojo.permissionKey!}"  placeholder="权限标识">
        </div>
        <hr>
        <div  class="form-group">
            <label for="nav" class="control-label x85">是否导航：</label>
            @if(!isEmpty(pojo.isNav)&&pojo.isNav){
            <input   id="nav" type="radio" name="isNav" value="1" checked="checked"> 是 </input>
            <input  id="nav" type="radio" name="isNav" value="0"> 否 </input>
            @}else{
            <input  id="nav"  type="radio" name="isNav" value="1"> 是 </input>
            <input  id="nav" type="radio" name="isNav" value="0" checked="checked"> 否 </input>
            @}

        </div>
        <hr>
        <div  class="form-group">
            <label for="nav" class="control-label x85">全文检索：</label>
            @if(!isEmpty(pojo.allowSearch)&&pojo.allowSearch){
            <input   id="nav" type="radio" name="allowSearch" value="1" checked="checked"> 是 </input>
            <input  id="nav" type="radio" name="allowSearch" value="0"> 否 </input>
            @}else{
            <input  id="nav"  type="radio" name="allowSearch" value="1"> 是 </input>
            <input  id="nav" type="radio" name="allowSearch" value="0" checked="checked"> 否 </input>
            @}

        </div>
        <hr>
        <div class="form-group">
            <label for="pageSize" class="control-label x85">分页大小：</label>
            <input type="text"  id="pageSize" name="pageSize" size="30"
                   value="${pojo.pageSize!}"  data-rule="required;integer(+)"  placeholder="分页大小">
        </div>
        <hr>
        <div id="isNotExtendUrl">
        <div  class="form-group">
                <label for="modelId" class="control-label x85">内容模型：</label>
                <select id="modelId" data-toggle="selectpicker" ${isEmpty(pojo.modelId)?"":"disabled"} data-rule="required;"  name="modelId">
                    <option value="" >请选择</option>
                    @for(model in models){
                    @if(!isEmpty(pojo.modelId)&&pojo.modelId==model.modelId){
                    <option value="${model.modelId!}" selected="selected">${model.modelName!}</option>
                    @}else{
                    <option value="${model.modelId!}">${model.modelName!}</option>
                    @}
                    @}
                </select>
        </div>
        <hr>
        <div  class="form-group">
            <label  class="control-label x85">是否单页：</label>
                @if(isNotEmpty(pojo.alone)&&pojo.alone){
                <input id="isAlone"  type="radio" name="alone" value="true" checked="checked"> 是 </input>
                <input id="notAlone"   type="radio" name="alone" value="false"> 否 </input>
                @}else{
                <input id="isAlone"   type="radio" name="alone" value="true"> 是 </input>
                <input id="notAlone"   type="radio" name="alone" value="false" checked="checked"> 否 </input>
                @}
        </div>
            <div  class="form-group">
                <label  class="control-label x85">栏目类型：</label>
                @if(isNotEmpty(pojo.isCommon)&&pojo.isCommon){
                <input id="isAlone"  type="radio" name="isCommon" value="true" checked="checked"> 全局 </input>
                <input id="notAlone"   type="radio" name="isCommon" value="false"> 当前 </input>
                @}else{
                <input id="isAlone"   type="radio" name="isCommon" value="true"> 全局 </input>
                <input id="notAlone"   type="radio" name="isCommon" value="false" checked="checked"> 当前 </input>
                @}
                &nbsp;(选择全局后,添加子站点的时候将自动创建)
            </div>
            <!-- 开始 -->
            @if(isNotEmpty(pojo.alone)&&pojo.alone){
            <div id="content" class="form-group">
            @}else{
            <div id="content" class="form-group hidden">
            @}
                <!--<textarea id="contents"  data-toggle="wangEditor"   style="height:450px;max-height:550px;" name="content">${pojo.content!,xss="escape"}-->
			    <!--</textarea>-->

                <textarea  data-toggle="CKEditor"  data-upload="${ctxPath}/upload/CKEditorUpload"   style="height:650px;max-height:750px;margin:10px 0 0 0" name="content">${pojo.content!,xss="escape"}</textarea>

            </div>
            <!--结束 -->
        <hr>
        <div class="form-group">
            <label for="index_tpl" class="control-label x85">栏目首页：</label>
            <input type="text" id="index_tpl" name="indexTpl" size="30"
                   value="${pojo.indexTpl!,xss}"  placeholder="首页模板，默认：default/channel">.html &nbsp;( 留空则继承父类！)
        </div>
        <hr>
        <div class="form-group">
            <label for="list_tpl" class="control-label x85">栏目列表：</label>
            <input type="text" id="list_tpl" name="listTpl" size="30"
                           value="${pojo.listTpl!,xss}" placeholder="列表页模板，默认：default/list">.html &nbsp; ( 同上.)
        </div>
        <hr>
        <div class="form-group">
                    <label for="content_tpl" class="control-label x85">内容页面：</label>
                    <input type="text" id="content_tpl" name="contentTpl" size="30"
                           value="${pojo.contentTpl!,xss}" placeholder="内容页模板，默认：default/content">.html &nbsp; ( 同上.)
        </div>
        <hr>
        <div class="form-group">
          <label for="sortId" class="control-label x85">排序：</label>
           <input type="text"  id="sortId" name="sortId" size="30"
                           value="${pojo.sortId!}"  data-rule="integer;"  placeholder="排序">
        </div>
       </div>
    </form>
    </div>
<div class="bjui-pageFooter">
    <ul>
        @if(isEmpty(pojo.categoryId)){
        <li><button type="submit" class="btn-default"  data-icon="save">保存</button></li>
        @}else{
        <li><button onclick="del(this)" type="button" class="btn-close" data-icon="close">删除</button></li>
        <li><button type="submit" class="btn-default"  data-icon="save">更新</button></li>
        @}
    </ul>
</div>